package com.hundsun.yr.universal.p2p.interactor.impl;

import com.hundsun.yr.universal.p2p.interactor.base.RequestInteractor;
import com.hundsun.yr.universal.p2p.listener.BaseMultiLoadedListener;
import com.hundsun.yr.universal.p2p.utils.VolleyRequest;

import org.json.JSONObject;

import java.util.HashMap;


/**
 * post请求
 *
 * @version V1.0
 * @Title: StringRequestInteractorImpl.java
 * @Description: string请求
 * @date 2015-11-11 上午11:16:59
 * @author:hejun.shen
 * @email:shenhj15971@hundsun.com
 * @replace author:
 * @replace date:
 */
public class StringRequestInteractorImpl implements RequestInteractor {

    private BaseMultiLoadedListener<String> loadedListener = null;
    private VolleyRequest request = null;

    public StringRequestInteractorImpl(BaseMultiLoadedListener<String> loadedListener) {
        this.loadedListener = loadedListener;
    }

    /**
     * 网络请求post params|header
     *
     * @param task_name
     * @param url
     * @param event_tag
     * @param params
     */
    @Override
    public void getRequestData(String task_name, String url, int event_tag, HashMap<String, String> params) {
        request = new VolleyRequest(true);
        request.StringRequestPost(task_name, url, event_tag, params, loadedListener);
    }

    /**
     * 网络请求 post params+header
     *
     * @param task_name
     * @param url
     * @param event_tag
     * @param params
     * @param header
     */
    @Override
    public void getRequestData(String task_name, String url, int event_tag, HashMap<String, String> params, HashMap<String, String> header) {
        request = new VolleyRequest(true);
        request.StringRequestPost(task_name, url, event_tag, params, header, loadedListener);
    }

    @Override
    public void getRequestData(String task_name, String url, int event_tag, JSONObject params, HashMap<String, String> header) {
        request = new VolleyRequest(true);
        request.StringRequestPost(task_name, url, event_tag, params, header, loadedListener);
    }

}
